//package com.hss.common.utils;
//
//
//import javax.crypto.Cipher;
//import javax.crypto.KeyGenerator;
//import javax.crypto.spec.IvParameterSpec;
//import javax.crypto.spec.SecretKeySpec;
//import java.security.SecureRandom;
//
//
///**
// * Created by jly on 2015/3/17.
// */
//public class DESUtil {
//    //算法名称
//    public static final String KEY_ALGORITHM = "DES";
//
//    public static final String CIPHER_ALGORITHM = "DES/CBC/PKCS5Padding";
//
//    public static final String SECRET_KEY = "qwdasdrs";
//
//    private static byte[] iv = {1,2,3,4,5,6,7,8};
//    private static IvParameterSpec zeroIv = new IvParameterSpec(iv);
//
//
//    /**
//     * 加密*
//     *
//     * @param encryptString
//     * @param encryptKey
//     * @return
//     * @throws Exception
//     */
//    public static String encrypt(String encryptString, String encryptKey) throws Exception {
//
//        SecretKeySpec key = new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM);
//        Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
//        cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv);
//        byte[] encryptedData = cipher.doFinal(encryptString.getBytes());
//
//        return Base64.encode(encryptedData);
//    }
//
//    /**
//     * 解密*
//     *
//     * @param decryptString
//     * @param decryptKey
//     * @return
//     * @throws Exception
//     */
//    public static String decrypt(String decryptString, String decryptKey) throws Exception {
//        byte[] byteMi = new Base64().decode(decryptString);
//        SecretKeySpec key = new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM);
//        Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
//        cipher.init(Cipher.DECRYPT_MODE, key, zeroIv);
//        byte decryptedData[] = cipher.doFinal(byteMi);
//        return new String(decryptedData);
//    }
//
//
//
//}
